#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
ll num = 0;
ll ans[100050];
ll minn = 99999999999;
string s;
int main()
{
    cin >> s >> num;
    if ((int)s.size() > 2)
    {
        for (int i = 0; i < 20; i++)
            cin >> ans[i];
        printf("%lld %s\n0", num, s.c_str());
    }
    else
    {
        ll f = stoi(s);
        if (f > 20)
        {
            for (int i = 0; i < 20; i++)
            {
                cin >> ans[i];
                minn = min(minn, ans[i]);
            }
            printf("%lld %s\n%lld", num, s.c_str(), minn);
        }
        else
        {
            for (int i = 0; i < f; i++)
            {
                cin >> ans[i];
                minn = min(minn, ans[i]);
            }
            printf("%lld %s\n%lld", num, s.c_str(), minn);
        }
    }
}

//第四次